package com.example.common.exception;

import com.example.common.enums.ErrorCodeEnum;

public class BusinessException extends RuntimeException {
    private final ErrorCodeEnum errorCode;
    public BusinessException(ErrorCodeEnum errorCode, String message) {
        super(message);
        // 可以扩展保存errorCode用于后续处理
        this.errorCode = errorCode;
    }

    public int getCode() {
        return errorCode.getCode();
    }
    public String getMessage() {
        return errorCode.getMessage();
    }
}
